home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-05-19 | 43.0 KB | 1,635 lines |
- Newsgroups: comp.sources.misc
- From: tony@ajfcal.UUCP (Tony Field)
- subject: v12i106: psf2.0 source 3/6
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 12, Issue 106
- Submitted-by: tony@ajfcal.UUCP (Tony Field)
- Archive-name: psf2/part03
-
- psf2.0 source 3/6
- =================
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 3 (of 6)."
- # Contents: Install.xenix Readme.Install Readme.Xenix pmf.c pnf.c
- # selectdef.c
- # Wrapped by ajf@trifid on Tue May 15 01:10:45 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'Install.xenix' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Install.xenix'\"
- else
- echo shar: Extracting \"'Install.xenix'\" \(6508 characters\)
- sed "s/^X//" >'Install.xenix' <<'END_OF_FILE'
- X:
- X# Install psf filters on Xenix 2.* (install.xenix)
- X#
- X# note: this script records configuration parameters in
- X# various ".cfg" files in the current directory.
- X# it also expects some .cfg files to be created
- X# by "selectdef".
- X
- XPATH=.:/bin:/usr/bin:/etc
- X
- XINSTALLPOINT="/tmp/psf"
- X
- X# sense if we are running from "install" or from a normal directory
- X# If from "install" then $0 == "init.psf". the normal script file
- X# name is "installpsf".
- X
- Xcase $0 in
- X *Install.xenix)
- X ;;
- X *) cd $INSTALLPOINT
- X ;;
- Xesac
- X
- XDEFDIR="/usr/spool/lp/model/psfprint.def"
- XBINDIR="/usr/local/bin"
- XSPOOLDIR="/usr/spool/lp"
- X
- XINTERFACE="$SPOOLDIR/interface"
- XMODEL="$SPOOLDIR/model"
- XDEFFILES="defs/*.def"
- XPAGESIZE="undefined"
- XPNAME="undefined"
- XBINARIES="psf pnf pmf psd psbanner psdetect"
- XMANS="psf.1 pnf.1 pmf.1 psd.1 psmbox.1 psman.1 psnroff.1"
- XSCRIPTS="psmbox psman psmandouble psnroff"
- XMANCHAP="LOCAL"
- X
- X
- X# get existing psf installation parameters
- X
- Xif test -f Pmanchap.cfg
- Xthen
- X MANCHAP=`cat Pmanchap.cfg`
- Xfi
- X
- Xif test -f Pbindir.cfg
- Xthen
- X BINDIR=`cat Pbindir.cfg`
- Xfi
- X
- X# Define return values
- X
- X: ${OK=0} ${FAIL=1} ${STOP=10} ${HALT=11}
- X
- X
- X# Print an error message
- Xerror() {
- X echo "\nError: $*" >&2
- X return 1
- X}
- X
- X# Prompt with mesg, return non-zero on q
- Xprompt() {
- X while echo "\n${mesg}or enter q to $quit: \c" >&2
- X do read cmd
- X case $cmd in
- X +x|-x) set $cmd ;;
- X Q|q) return 1 ;;
- X !*) eval `expr "$cmd" : "!\(.*\)"` ;;
- X "") # If there is an argument use it as the default
- X # else loop until 'cmd' is set
- X [ "$1" ] && {
- X cmd=$1
- X return 0
- X }
- X : continue
- X ;;
- X *) return 0 ;;
- X esac
- X done
- X}
- X
- X
- Xshowstats () {
- X echo "\nPSF INSTALLATION OPTIONS SELECTED"
- X echo "--------------------------------"
- X echo "printer selected from: $PNAME"
- X echo "printer page size is: $PAGESIZE"
- X echo "psf default options: $PSFOPT"
- X echo "banner options: $BANNEROPT"
- X echo "binaries and scripts in: $BINDIR"
- X echo "man pages in chapter: $MANCHAP"
- X}
- X
- Xcreateprinter () {
- X bdir="$BINDIR"
- X echo " "
- X echo "Install PSF binaries and"
- X ./query " scripts in which directory [$bdir]? "
- X read bdir
- X case "$bdir" in
- X '') ;;
- X *) BINDIR="$bdir"
- X ;;
- X esac
- X if test ! -d $BINDIR
- X then
- X echo "\nDirectory $BINDIR does not exist."
- X echo "Create the directory and re-start the installation.\n"
- X exit $FAIL
- X fi
- X echo "$BINDIR" > Pbindir.cfg
- X cp $BINARIES $BINDIR
- X cp $SCRIPTS $BINDIR
- X rm -f psf.model
- X sed "s@BINARY@$BINDIR@g" psfxenix.LP | sed "s@OPTIONS@$PSFOPT@g" \
- X | sed "s@BANNER@$BANNEROPT@g" > psf.model
- X chmod +rw psf.model
- X cp psf.model $MODEL/psf.model
- X cp $PNAME $DEFDIR
- X chown lp $MODEL/psf.model $DEFDIR
- X chgrp bin $MODEL/psf.model $DEFDIR
- X
- X showstats
- X echo "\nNow use menu item 2 to install this printer with 'mkdev lp'."
- X return 0
- X}
- X
- X
- Xgetsizes () {
- X PAGESIZE=`cat Ppagesize.cfg`
- X PNAME=`cat Ppsfprint.cfg`
- X cp $PNAME psfprint.def
- X case $PAGESIZE in
- X DEFAULT) PSFOPT= ;;
- X *) PSFOPT=`echo -g $PAGESIZE` ;;
- X esac
- X case $PAGESIZE in
- X DEFAULT) BANNEROPT= ;;
- X *) BANNEROPT=`echo -g $PAGESIZE` ;;
- X esac
- X return 0
- X}
- X
- Xreplaceprinter () {
- X selectdef $DEFFILES
- X case $? in
- X 0) ;;
- X *) return $?
- X esac
- X getsizes
- X return 0
- X}
- X
- X
- Xmanpages () {
- X echo "\nNormally, PSF man pages for xenix should be placed in the 'LOCAL'"
- X echo "chapter. Some sites prefer to use other chapters."
- X cdir="$MANCHAP"
- X echo " "
- X ./query "Which chapter should be used for the PSF man pages [$cdir]? "
- X read cdir
- X case "$cdir" in
- X '') ;;
- X *) MANCHAP="$cdir"
- X ;;
- X esac
- X if test ! -d /usr/man/man.$MANCHAP
- X then
- X echo "\nDirectory /usr/man/man.$MANCHAP does not exist."
- X echo "Create the directory and re-start the manual installation.\n"
- X exit $FAIL
- X fi
- X
- X cp pmf.1 /usr/man/man.$MANCHAP/pmf.$MANCHAP
- X cp pnf.1 /usr/man/man.$MANCHAP/pnf.$MANCHAP
- X cp psf.1 /usr/man/man.$MANCHAP/psf.$MANCHAP
- X cp psd.1 /usr/man/man.$MANCHAP/psd.$MANCHAP
- X cp psman.1 /usr/man/man.$MANCHAP/psman.$MANCHAP
- X cp psnroff.1 /usr/man/man.$MANCHAP/psnroff.$MANCHAP
- X cp psmbox.1 /usr/man/man.$MANCHAP/psmbox.$MANCHAP
- X man $MANCHAP pmf > /dev/null
- X man $MANCHAP pnf > /dev/null
- X man $MANCHAP psd > /dev/null
- X man $MANCHAP psf > /dev/null
- X man $MANCHAP psman > /dev/null
- X man $MANCHAP psnroff > /dev/null
- X man $MANCHAP psmbox > /dev/null
- X echo "$MANCHAP" > Pmanchap.cfg
- X echo "\nPSF man pages have been installed in /usr/man/man.$MANCHAP"
- X return 0
- X}
- X
- Xprintman () {
- X if test ! -d /usr/man/man.$MANCHAP
- X then
- X psf -2l 66 $DOCS | lp
- X else
- X psnroff -man $MANS
- X fi
- X
- X return 0
- X}
- X
- Xremoveall () {
- X cdir="$MANCHAP"
- X echo " "
- X ./query "Remove PSF man pages from chapter [$cdir]? "
- X read cdir
- X case "$cdir" in
- X '') ;;
- X *) MANCHAP="$cdir"
- X ;;
- X esac
- X if test ! -d /usr/man/man.$MANCHAP
- X then
- X echo "\nDirectory /usr/man/man.$MANCHAP does not exist."
- X exit $FAIL
- X fi
- X
- X bdir="$BINDIR"
- X echo " "
- X ./query "Remove PSF binaries+scripts from directory [$bdir]? "
- X read bdir
- X case "$bdir" in
- X '') ;;
- X *) BINDIR="$bdir"
- X ;;
- X esac
- X if test ! -d $BINDIR
- X then
- X echo "\nDirectory $BINDIR does not exist."
- X exit 1
- X fi
- X
- X rm -f /usr/man/man.$MANCHAP/pmf.$MANCHAP
- X rm -f /usr/man/man.$MANCHAP/pnf.$MANCHAP
- X rm -f /usr/man/man.$MANCHAP/psf.$MANCHAP
- X rm -f /usr/man/man.$MANCHAP/psd.$MANCHAP
- X rm -f /usr/man/man.$MANCHAP/psman.$MANCHAP
- X rm -f /usr/man/man.$MANCHAP/psnroff.$MANCHAP
- X rm -f /usr/man/man.$MANCHAP/psmbox.$MANCHAP
- X
- X rm -f /usr/man/cat.$MANCHAP/pmf.$MANCHAP
- X rm -f /usr/man/cat.$MANCHAP/pnf.$MANCHAP
- X rm -f /usr/man/cat.$MANCHAP/psf.$MANCHAP
- X rm -f /usr/man/cat.$MANCHAP/psd.$MANCHAP
- X rm -f /usr/man/cat.$MANCHAP/psman.$MANCHAP
- X rm -f /usr/man/cat.$MANCHAP/psnroff.$MANCHAP
- X rm -f /usr/man/cat.$MANCHAP/psmbox.$MANCHAP
- X
- X thisdir=`pwd`
- X
- X cd $BINDIR
- X rm $BINARIES $SCRIPTS
- X
- X cd $thisdir
- X
- X rm $MODEL/psf.model
- X rm $DEFDIR
- X
- X return 0
- X}
- X
- X
- X#
- X# main()
- X#
- Xecho '\n\tPSF: Postscript print filter installation'
- Xwhile
- X mesg='\t1. Select printer type, install psf, make printer model.
- X 2. Install selected printer with mkdev lp.
- X 3. Install man pages in /usr/man.
- X 4. Print man pages.
- X 5. Remove psf software and files from binary and spool directories.
- X
- XSelect an option '
- X quit=quit
- Xdo
- X prompt
- X choice=$cmd
- X quit="return to the previous menu"
- X case $choice in
- X 1) # select and install
- X replaceprinter
- X [ -r Ppagesize.cfg ] && [ -r Ppsfprint.cfg ] && [ -r $PNAME ] && createprinter
- X ;;
- X 2) mkdev lp
- X ;;
- X 3) manpages
- X ;;
- X 4) printman
- X ;;
- X 5) removeall
- X ;;
- X [qQ]) break ;;
- X *) error "unknown option: \"$choice\""
- X ;;
- X esac
- Xdone
- Xexit $OK
- END_OF_FILE
- if test 6508 -ne `wc -c <'Install.xenix'`; then
- echo shar: \"'Install.xenix'\" unpacked with wrong size!
- fi
- chmod +x 'Install.xenix'
- # end of 'Install.xenix'
- fi
- if test -f 'Readme.Install' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Readme.Install'\"
- else
- echo shar: Extracting \"'Readme.Install'\" \(6956 characters\)
- sed "s/^X//" >'Readme.Install' <<'END_OF_FILE'
- X P S F I N S T A L L A T I O N (manual)
- X =================================
- X and other notes
- X
- X If you are using Xenix 2.3.x, you shoud be reading the file
- X
- X Readme.Xenix
- X
- X and use: Install.xenix
- X
- X If yow are using AT&T Unix 3.2.2, you should be reading the file
- X
- X Readme.Unix
- X
- X and use: Install.unix
- X
- X If your are using a different system or wish to manually install psf,
- X you are reading the correct file. (you might also wish to read
- X Readme.Unix to get some additional information..)
- X
- X
- X
- XMANUAL INSTALLATION
- X^^^^^^^^^^^^^^^^^^^
- X
- X1. Edit the Makefile to reflect the binary target directory for the psf
- X system.
- X
- X2. Psf requires a "printer definition file" named "psfprint.def" that
- X describes the postscript printer. The file name is compiled into
- X various psf modules. Edit the Makefile to provide the desired file
- X path/name.
- X
- X3. Compile all sources with "make all".
- X
- X4. Generate a "printer definition file". This is done by the
- X command:
- X selectdef defs/*.def
- X
- X "selectdef" will access all of printer definitions in the defs/
- X directory and copy your selected printer definition into the current
- X directory with a name of "psfprint.def" (or different name if you
- X changed it in (2) above). The copy operation could be done manually
- X - however you will not get a "psizes.ps" programme generated.
- X
- X Selectdef also generates a postscript programme file "psizes.ps" that
- X will print out the actual imageable area recorded in the printer roms
- X for each page size known to your printer. The psizes.ps file should
- X be sent to the printer with:
- X
- X cat psizes.ps | lp
- X or
- X cat psizes.ps > /dev/lp
- X
- X The resulting figures can be used to modify the psfprint.def file to
- X accurately define your printer's imageable area.
- X
- X Even though the various defs/*.def files are derived from the Adobe
- X .ppd files, the .ppd files for the printers do not necessarily
- X reflect the accurate imageable areas actually implemented by the
- X printer manufacturer. For example, the NEC__470.ppd file provided by
- X Adobe does not describe the imageable area that is actually in my
- X LC890. Thus, psizes.ps is a handy way to determine your
- X exact printer imageable area.
- X
- X If your printer is not known in the various defs/*.def files, then
- X choose the closest approximation.
- X
- X If that is not good enough, you should modify the postscript
- X programme at the end of this Readme file (or use the psizes.ps
- X generated for the "closest approximation") to reflect the various
- X paper sizes supported by your printer. Send the resulting programme
- X to the printer, and construct a psfprint.def file based upon it's
- X results. Use the "sample.def" file as a starting point to generate
- X your .def file.
- X
- X5. Copy the desired psf binaries and scripts to the binary directory
- X (as per the Makefile definition). Probably "selectdef" and "table"
- X should NOT be copied. (or use "make all").
- X
- X If you are not using Letter size paper as your standard, you may need
- X to make some modifications to the scripts as described in (11) below.
- X
- X6. Copy the "psfprint.def" printer definition file to the target file
- X (as per the Makefile definition). (also copied with "make all").
- X
- X7. If you intend to run psf as part of the print spooler, then copy
- X "psfsample.LP" to another file. Edit this new file to configure the
- X printer model.
- X
- X If you have a serial printer, examine the stty command to ensure
- X correct port configuration.
- X
- X Install the printer model as needed for your printer system. If your
- X spooler allows passing of printer options with the "-o" option, then
- X you could use (for example):
- X
- X lp -o"-4xh" this.file that.file
- X
- X The "-4xh" options are passed by lp to psf to print the files "4-up"
- X on a page, with file name headers (h) and dividing lines between
- X quandrants (x). Any set of options may be enclosed between the
- X quotation marks.
- X
- X
- X8. If you do not intend to run psf as part of the spooler, you
- X are finished. psf is then used as a print filter manually.
- X
- X For example:
- X
- X psf this.file | lp
- X
- X man -b vi | pnf -i | psf -2 | lp
- X
- X9. Install the man pages. E.g.: cp *.1 /usr/man/man.1
- X
- X10. Print the man pages: E.g.: psnroff -man *.1
- X or, if nroff is not avaliable: psf -2l 66 *.doc | lp
- X
- X11. Make any option changes to the various psf commands
- X in scripts. For example:
- X
- X psman: change the man chapters as per your man directories
- X (the distribution psman assumes Xenix directories)
- X psnroff: change the psf options (by default, the output
- X default is for two-up printing).
- X psmbox: change default psf printing characteristics.
- X psbanner.c: this routine prints banner pages. you may
- X wish to change the layout of banner pages.
- X
- X If European paper sizes are used (A4, B5, etc), then the "-l nn" for
- X psf or the "-r nn -l nn" option to pnf may need to be specified.
- X
- X12. Edit the file "Testfile": this file, (after editing) is an example
- X of how escape seqeuences can be imbedded in a text file to allow
- X direct font control within a text editor (See psf.1 for details).
- X
- X The "Testfile" should contain many ^E characters (octal \005). Since
- X mail/news system may change the ^E character into the text string "005"
- X You will have to edit the Testfile and replace all "005" strings with
- X true ctrl-E character.
- X
- X One easy way to correct this is with sed:
- X
- X sed 's@005@<CTRL-E>@g' Testfile > newtest
- X +------+
- X actually type the CTRL-E character
- X to generate the octal charcter \005
- X
- X After editing, do the following:
- X
- X psf newtest | lp
- X
- X to see how font control can work in a text file.
- X
- X=========================================================================
- X
- X You can modify the following postscript programme (quickly now, rush
- X out and buy some postscript manuals....) to print out (on paper) the
- X imageable area of the various paper sizes. Normally, this file is
- X generated by "selectdef" and is named psizes.ps.
- X
- X
- X%!
- X/getsize {
- X clippath
- X pathbbox
- X} def
- X/sendsize {
- X /ury exch def
- X /urx exch def
- X /lly exch def
- X /llx exch def
- X /str 64 string def
- X show
- X ( ) show
- X llx ceiling cvi str cvs show
- X ( ) show
- X lly ceiling cvi str cvs show
- X ( ) show
- X urx floor cvi str cvs show
- X ( ) show
- X ury floor cvi str cvs show
- X} def
- X/pg save def
- Xnewpath
- Xb5
- X(B5: 516 729) getsize
- Xa4
- X(A4: 595 842) getsize
- Xlegal
- X(Legal: 612 1008) getsize
- Xletter
- X(Letter: 612 792) getsize
- Xstatusdict begin lettertray end
- X/Courier findfont 12 scalefont setfont
- X50 600 moveto
- X(Imageable area) show
- X50 585 moveto
- X(NEC LC-890 v47.0 \(corrected\)) show
- X50 565 moveto
- Xsendsize
- X50 550 moveto
- Xsendsize
- X50 535 moveto
- Xsendsize
- X50 520 moveto
- Xsendsize
- Xshowpage
- Xpg restore
- END_OF_FILE
- if test 6956 -ne `wc -c <'Readme.Install'`; then
- echo shar: \"'Readme.Install'\" unpacked with wrong size!
- fi
- # end of 'Readme.Install'
- fi
- if test -f 'Readme.Xenix' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Readme.Xenix'\"
- else
- echo shar: Extracting \"'Readme.Xenix'\" \(6949 characters\)
- sed "s/^X//" >'Readme.Xenix' <<'END_OF_FILE'
- X P S F I N S T A L L A T I O N (Xenix 2.x)
- X =================================
- X
- X First examine the Makefile to esure that the compilation options are
- X as needed for your system. Then compile the source code with "make all".
- X
- X If psf is being used with a serial postscript printer, examine the
- X psfxenix.LP file and make any needed modifications to the stty
- X command that sets up the serial port. The psfxenix.LP file is the
- X prototype printer model that will eventually be copied to
- X /usr/spool/lp/model.
- X
- X If on-line man pages are not available, the printing of the man
- X pages will use preformatted *.doc files.
- X
- X You might also wish to read the "Readme.Install" file.
- X
- X PSF is installed with the Install.xenix script. To do so, you must
- X be root (to allow the creation of various files and directories).
- X
- X The Install.xenix script asks:
- X
- X 1. Select printer type, install psf, make printer model.
- X 2. Install selected printer with mkdev lp.
- X 3. Install man pages in /usr/man.
- X 4. Print man pages.
- X 5. Remove psf software and files from binary and spool directories.
- X
- X ===> Select an option or enter q to quit:
- X
- X First select option 1: this allows you to configure psf to your
- X postscript printer. The list is presented as follows:
- X
- X SELECT PRINTER TYPE
- X
- X 1: Apple LaserWriter v23.0 2: Apple LaserWriter Plus v38.0
- X 3: Apple LaserWriter Plus v42.2 4: AST TurboLaser/PS v47.0
- X 5: Agfa-Compugraphic 9400P v49.3 6: Dataproducts LZR-2665 v47.0
- X 7: Dataproducts LZR 1260 v47.0 8: IBM 4216-020 v47.0
- X 9: IBM 4216-030 v50.5 10: Linotronic 100 v38.0
- X11: Linotronic 100 v42.5 12: Linotronic 200 v47.1
- X13: Linotronic 200 v49.3 14: Linotronic 300 v47.0
- X15: Linotronic 300 v47.1 16: Linotronic 300 v49.3
- X17: Linotronic 500 v49.3 18: Apple LaserWriter II NT v47.0
- X19: Apple LaserWriter II NTX v47.0 20: NEC LC-890 v47.0 (corrected)
- X21: NEC LC-890 v47.0 22: QMS-PS 810 v47.0
- X23: QMS-PS 800 v46.1 24: QMS-PS 800 Plus v46.1
- X25: QMS ColorScript 100 v49.3 26: Qume ScripTEN v47.0
- X27: Schlumberger 5232 Color PostScript Printer v50.3
- X28: TI OmniLaser 2108 v45.0 29: TI Omnilaser 2115 v47.0
- X30: Varityper 4200B-P v49.3 31: Varityper 4300P v49.3
- X32: Varityper VT-600P v48.0 33: Varityper VT-600W v48.0
- X==> Select printer by number (q = quit, r = refresh display):
- X
- X After the printer type is selected, you are asked to specify the
- X default paper size that psf will assume unless otherwise instructed:
- X
- X Select default page size:
- X 1: Letter
- X 2: Legal
- X 3: A4
- X 4: B5
- X ==> Select page size by number (q = quit, r = refresh display):
- X
- X (The list of page sizes is dependent upon the selected printer type.
- X As a result, the list may differ from the above sample)
- X
- X
- X The destination directory for the PSF binaries and script files must
- X be specified. By default, the destination is /usr/bin. You may
- X specify any other directory (such as /usr/local/bin, etc). The only
- X requirement is that the various uses of PSF are pathed to the
- X specified directory.
- X
- X Install PSF Binaries and
- X scripts in which directory [/usr/bin]?
- X
- X
- X The various binaries, scripts and printer defintion files are then
- X copied to the appropriate target directories. An appropriate printer
- X model is copied to /usr/spool/lp/model.
- X
- X At this point, you may now quit the installation process if you wish.
- X If you quit now, then you will have to use "mkdev lp" to install your
- X printer. The PSF postscript printer is a selectable printer type in
- X "mkdev lp".
- X
- X
- X Optionally, you can continue with the installation by selecting
- X option 2 from:
- X
- X 1. Select printer type, install psf, make printer model.
- X 2. Install selected printer with mkdev lp.
- X 3. Install man pages in /usr/man.
- X 4. Print man pages.
- X 5. Remove psf software and files from binary and spool directories.
- X
- X This will invoke "mkdev lp" for you.
- X
- X
- X The PSF installation directory in /tmp/psf is NOT automatically
- X deleted. You must remove this directory manually or copy it to a
- X suitable "save" directory before deletion.
- X
- X If you have the text processing system installed with man pages, then
- X you may use option 3 to install the on line man pages.
- X
- X With option 4, you may print a copy of the man pages. (Printing will
- X used the pre-formatted *.doc files if on line man pages are not
- X available)
- X
- X
- XAFTER INSTALLATION
- X^^^^^^^^^^^^^^^^^^
- X Edit the file "Testfile": this file, (after editing) is an example
- X of how escape seqeuences can be imbedded in a text file to allow
- X direct font control within a text editor (See psf.1 for details).
- X
- X The "Testfile" should contain many ^E characters (octal \005). Since
- X mail system may change the ^E character into the text string "005"
- X You will have to edit the testfile and replace all "005" strings with
- X true ctrl-E character.
- X
- X One easy way to correct this is with sed:
- X
- X sed 's@005@<CTRL-E>@g' Testfile > testfile
- X +-----+
- X actually type the CTRL-E character
- X to generate the octal charcter \005
- X
- X After editing, do the following:
- X
- X psf testfile | lp
- X
- X to see how font control can work in a text file.
- X
- X
- X
- X
- XPSF notes.
- X
- X The printer definitions in ~psf/defs are derived from the Adobe
- X ".ppd" files. These are available from the Adobe file server via
- X email. The programme "table" is used to translate the ".ppd" files
- X into ".def" printer definition files used by psf.
- X
- X If the user's printer is not in the list of available printers, a
- X suitable .def definition must be manually constructed (see file
- X "sample.def" as a guide).
- X
- X
- XPROBLEMS:
- X
- X The adobe .ppd files not not necessarily describe the "true"
- X printable area of the printers. For example, the printable area of a
- X NEC LC890 printer is different than described in the nec_lc890.ppd
- X file. I do not know which .ppd files are "accurate" or "inaccurate"!
- X
- X To determine actual imageable area for your printer, you should send
- X file "psizes.ps" to the printer. Then read the notes in the
- X Readme.Install file (in particular, point 4).
- X
- X If PSF is to be used over uucp/micnet connections, then the spooler
- X backend should ensure that the "-o" options are properly quoted.
- X It must pass the options such as:
- X
- X -o"-g Legal -m 72"
- X
- X properly to the remote printer. Alternatively, the local machine
- X could wrap the postscript and simply send results to the remote
- X printer without worrying about the -o options.
- END_OF_FILE
- if test 6949 -ne `wc -c <'Readme.Xenix'`; then
- echo shar: \"'Readme.Xenix'\" unpacked with wrong size!
- fi
- # end of 'Readme.Xenix'
- fi
- if test -f 'pmf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'pmf.c'\"
- else
- echo shar: Extracting \"'pmf.c'\" \(6418 characters\)
- sed "s/^X//" >'pmf.c' <<'END_OF_FILE'
- X/* ta=4 */
- X/****************************************************************************
- X* p m f . c v2.0 *
- X* *
- X* postscript mail filter *
- X* *
- X* very simple mail filter to print name and subject in bold letters *
- X* for psf usage. Generates escape sequences that psf can understand. *
- X* Modify the code if you wish to have various headers ignored for print. *
- X* *
- X* Copyright: 1989-Feb, Tony Field. tony@ajfcal *
- X****************************************************************************/
- X/* revision history:
- X
- X 1989-May-20 allow input from multiple file names as well as stdin
- X*/
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include <ctype.h>
- X#include "patchlevel.h"
- X#include "psf.h"
- X
- X#define MAX_C 62 /* max char wrap point on mail header line */
- X
- Xchar *pgmname;
- X
- Xmain (argc, argv)
- Xint argc;
- Xchar *argv[];
- X{
- X int ignore_garbage, i;
- X extern char *optarg;
- X extern int optind;
- X FILE *input_fp;
- X
- X pgmname = argv[0];
- X ignore_garbage = 1;
- X if (strcmp (argv[1], "-") == 0)
- X usage();
- X while ((i = getopt(argc, argv, "s-")) != -1)
- X { switch (i)
- X {
- X case 's':
- X ignore_garbage = 0; /* print all headers */
- X break;
- X
- X default:
- X usage ();
- X }
- X }
- X if (optind >= argc)
- X { input_fp = stdin;
- X print_file (input_fp, ignore_garbage);
- X }
- X else
- X {
- X for ( i = 0; optind < argc; optind++)
- X { if ((input_fp = fopen (argv[optind], "r")) == NULL)
- X { fprintf (stderr, "%s: File %s not found\n", pgmname, argv[optind]);
- X }
- X else
- X { if (i)
- X send ("\f");
- X print_file (input_fp, ignore_garbage);
- X fclose (input_fp);
- X i++;
- X }
- X }
- X }
- X exit (0);
- X}
- X
- Xprint_file (fp, ignore_garbage)
- XFILE *fp;
- Xint ignore_garbage;
- X{
- X char line[900], first[100], tail[800], *strchr();
- X int i, many, nchar, last_char, header, garbage;
- X
- X header = garbage = 0;
- X while (fgets (line, 999, fp) != NULL)
- X {
- Xnewmail:
- X last_char = split (line, first, tail);
- X
- X /* The following headers will be ignored during printing */
- X
- X if (ignore_garbage
- X && (strcmp (first, "Distribution:" ) == 0
- X || strcmp (first, "Keywords:" ) == 0
- X || strcmp (first, "Lines:" ) == 0
- X || strcmp (first, "Message-ID:" ) == 0
- X || strcmp (first, "Message-Id:" ) == 0
- X || strcmp (first, "News-Path:" ) == 0
- X || strcmp (first, "Path:" ) == 0
- X || strcmp (first, "Posted:" ) == 0
- X || strcmp (first, "Received:" ) == 0
- X || strcmp (first, "References:" ) == 0
- X || strcmp (first, "Sender:" ) == 0
- X || strcmp (first, "Status:" ) == 0
- X || strncmp(first, "X-", 2 ) == 0))
- X { garbage = 1;
- X }
- X else if (strcmp (first, "From") == 0)
- X { printclean (first, tail);
- X garbage = 0;
- X }
- X else if (strcmp (first, "From:") == 0
- X || strcmp (first, "Reply-To:") == 0
- X || strcmp (first, "To:") == 0)
- X { header = 1;
- X if ((strchr (tail, '(') == NULL) && (strchr (tail, '<') == NULL))
- X printbold (first, tail);
- X else
- X printname (first, tail);
- X garbage = 0;
- X }
- X else if (strcmp (first, "Bcc:") == 0 || strcmp (first, "Cc:") == 0)
- X { header = 1;
- X printname (first, tail);
- X garbage = 0;
- X }
- X else if (strcmp (first, "Subject:") == 0)
- X { printsubject (first, tail);
- X garbage = 0;
- X }
- X else if (last_char == ':')
- X {
- X header = 1;
- X printclean (first, tail);
- X garbage = 0;
- X }
- X else if (empty (line))
- X {
- X send ("\n");
- X while (fgets (line, 999, fp) != NULL)
- X { if (strncmp (line, "From ", 5) == 0
- X && (strchr (line, ':') < strrchr (line, ':')))
- X { send ("\f");
- X goto newmail; /* goto's considered harmful since 1964 */
- X }
- X printf ("%s", line);
- X }
- X break;
- X }
- X else if (garbage == 0)
- X printclean (" ", line);
- X }
- X}
- X
- Xprintclean (first, tail)
- Xchar *first, *tail;
- X{
- X printf ("%-14s", first);
- X printlong (tail);
- X}
- X
- Xprintlong (tail)
- Xchar *tail;
- X{ char *c, *prefix;
- X int marks[100], nmarks, i, j, nchar;
- X
- X /* locate all marks that can be use for a line break */
- X
- X marks[0] = 0;
- X marks[1] = 0;
- X c = tail;
- X for ( i = nchar = 0, nmarks = 1; nmarks < 100; i++, c++, nchar++)
- X {
- X if (*c == '!' || *c == ' ' || *c == '<'
- X || *c == '(' || *c == '\0')
- X { if (nchar < MAX_C)
- X marks[nmarks] = i;
- X else
- X { nchar = i - marks[nmarks];
- X marks[++nmarks] = i;
- X }
- X if (*c == '\0')
- X break;
- X }
- X }
- X marks[nmarks] = i;
- X for (i = 0; i < nmarks; i++)
- X {
- X if (i)
- X printf ("%-14s", " ");
- X for (j = marks[i]; j < marks[i+1]; j++)
- X putchar (tail[j]);
- X putchar ('\n');
- X }
- X}
- X
- Xprintsubject (first, tail)
- Xchar *first, *tail;
- X{
- X printf ("%-14s", first);
- X send (BEGIN_SUBJECT);
- X send (tail);
- X send (END_SUBJECT);
- X send ("\n");
- X}
- X
- Xprintbold (first, tail)
- Xchar *first, *tail;
- X{
- X printf ("%-14s", first);
- X send (BEGIN_BOLD);
- X printlong (tail);
- X send (END_BOLD);
- X}
- X
- Xprintname (first, tail)
- Xchar *first, *tail;
- X{
- X printf ("%-14s", first);
- X
- X if (strchr (tail, '<') != NULL)
- X { /* address syntax "name <address> stuff" */
- X send (BEGIN_NAME);
- X while (*tail != '<')
- X putchar (*tail++);
- X send (END_NAME);
- X putchar (*tail++);
- X while (*tail)
- X { putchar (*tail);
- X if (*tail++ == '>')
- X { if (*tail)
- X { send (BEGIN_NAME);
- X while (*tail)
- X putchar (*tail++);
- X send (END_NAME);
- X }
- X }
- X }
- X }
- X else
- X { /* address syntax "address (name)" */
- X while (*tail && *tail != '(')
- X putchar (*tail++);
- X if (*tail)
- X { send (BEGIN_NAME);
- X putchar (*tail++);
- X while (*tail)
- X { putchar (*tail);
- X if (*tail++ == ')')
- X { send (END_NAME);
- X while (*tail)
- X putchar (*tail++);
- X putchar ('\n');
- X return;
- X }
- X }
- X }
- X }
- X putchar ('\n');
- X}
- X
- Xsend (s)
- Xchar *s;
- X{
- X while (*s)
- X putchar (*s++);
- X}
- X
- Xempty (s)
- Xchar *s;
- X{ while (*s && *s <= ' ')
- X s++;
- X if (*s)
- X return (0);
- X else
- X return (1);
- X}
- X
- Xsplit (line, first, tail)
- Xchar *line; /* input: full input line */
- Xchar *first; /* return: first word of line */
- Xchar *tail; /* return: all others words of line*/
- X{ int last;
- X
- X last = 0;
- X while (*line && isspace (*line) == 0)
- X { last = *line;
- X *first++ = *line++;
- X }
- X *first = '\0';
- X
- X while (*line && isspace (*line))
- X line++;
- X
- X while (*line && *line != '\n')
- X *tail++ = *line++;
- X *tail = '\0';
- X *line = '\0';
- X return (last);
- X}
- X
- Xusage ()
- X{
- X fprintf (stderr, "Usage: pmf [-s] files... >out.file\n");
- X fprintf (stderr, " where -s = show all header lines\n");
- X fprintf (stderr, " files = input files (or stdin)\n");
- X exit (0);
- X}
- END_OF_FILE
- if test 6418 -ne `wc -c <'pmf.c'`; then
- echo shar: \"'pmf.c'\" unpacked with wrong size!
- fi
- # end of 'pmf.c'
- fi
- if test -f 'pnf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'pnf.c'\"
- else
- echo shar: Extracting \"'pnf.c'\" \(6253 characters\)
- sed "s/^X//" >'pnf.c' <<'END_OF_FILE'
- X/* ta=4 */
- X/****************************************************************************
- X* p n f . c v2.0 *
- X* *
- X* postscript filter for nroff'ed text *
- X* *
- X* Translate backspaces in nroff documents to either BOLD or UNDERLINE *
- X* for psf usage *
- X* *
- X* Copyright: 1989-Feb, Tony Field. tony@ajfcal *
- X****************************************************************************/
- X/* revision history:
- X
- X 1989-Jun-15 Added -l linecount. For nroff, suppress 3 blank lines
- X between nroff'ed pages.
- X
- X Corrected a very stupid programming mistake with how[i-1].
- X
- X Correct problem if "bold" is adjacent to "underline"
- X
- X Removed -x option. user must "man -b".
- X
- X 1989-May-20 Allow input from multiple file names as well as stdin
- X*/
- X
- X/* For each line in of input text, scan for backspaces. Determine if
- X the operation is an underline (i.e. the preceeding character is
- X the "_") or if it is a bolding (the character after the underscore
- X is the same as the preceeding.
- X
- X Generate the sequence \005B..text..\005b for bold
- X \005U..text..\005u for underline
- X \005I..text..\005i for italics
- X
- X Since the text from nroff does not have a decent way of identifying
- X italics, you may make the decision to generate the "italic" or
- X "underline" escape sequence whenever an underline is detected in
- X the output. Italic fonts look nicer than the underlines 2-up.
- X
- X The logic cannot handle bold-underlined (nor italic-underlined).
- X This could be done with a bit of extra logic to manipulate bits
- X in the "how" vector.
- X
- X For nroff, remove three blank lines between pages (an nroff'ed
- X document, letter size, has 66 lines. the postscript
- X printer must see 63 lines.) Assume that nroff is consistent.
- X If "point size" adjustments are made (e.g. some documents
- X originally intended for troff), then lines per page may not
- X be consistent.
- X
- X*/
- X
- X#include <stdio.h>
- X#include "psf.h"
- X#include "patchlevel.h"
- X
- Xchar *pgmname;
- X
- Xmain (argc, argv)
- Xint argc;
- Xchar *argv[];
- X{ int i, c;
- X int nroff_lines = 66;
- X int remove = 3;
- X int count_lines = 1;
- X char *underline_on, *underline_off;
- X extern char *optarg;
- X extern int optind;
- X FILE *input_fp;
- X
- X pgmname = argv[0];
- X underline_on = BEGIN_UNDERLINE;
- X underline_off = END_UNDERLINE;
- X
- X if (strcmp (argv[1], "-") == 0)
- X usage();
- X while ((c = getopt(argc, argv, "ifr:l:-")) != -1)
- X { switch (c)
- X {
- X case 'i':
- X underline_on = BEGIN_ITALICS;
- X underline_off = END_ITALICS;
- X break;
- X
- X case 'l':
- X nroff_lines = atoi (optarg);
- X break;
- X
- X case 'r':
- X remove = atoi (optarg);
- X break;
- X
- X case 'f':
- X count_lines = 0;
- X break;
- X
- X default:
- X usage ();
- X }
- X }
- X
- X if (optind >= argc)
- X { input_fp = stdin;
- X print_file (input_fp, nroff_lines, remove, underline_on, underline_off, count_lines);
- X }
- X else
- X {
- X for (i = 0 ; optind < argc; optind++)
- X { if ((input_fp = fopen (argv[optind], "r")) == NULL)
- X { fprintf (stderr, "%s: File %s not found\n", pgmname, argv[optind]);
- X }
- X else
- X { if (i)
- X send ("\f");
- X print_file (input_fp, nroff_lines, remove, underline_on, underline_off, count_lines);
- X fclose (input_fp);
- X i++;
- X }
- X }
- X }
- X exit (0);
- X
- X}
- X
- Xprint_file (fp, nroff_lines, remove, underline_on, underline_off, count_lines)
- XFILE *fp;
- Xint nroff_lines;
- Xint remove;
- Xint count_lines;
- Xchar *underline_on, *underline_off;
- X{
- X int c, n, i;
- X int how[401];
- X char line[401];
- X char buf[401];
- X int ii;
- X int nroff_count;
- X int insert_two = 0;
- X
- X nroff_count = n = 0;
- X
- X clear (line, how, 400);
- X while (( c = fgetc (fp)) != EOF)
- X {
- X if (c == '\033') /* if ESCAPE character, then handle */
- X { if ((c = fgetc (fp)) == EOF)
- X break;
- X if (c == '9') /* 1/2 line space fwd */
- X { putchar (ESCAPE);
- X putchar ('+');
- X nroff_count += 5;
- X continue;
- X }
- X else if (c == '8') /* 1/2 line space back */
- X { putchar (ESCAPE);
- X putchar ('-');
- X nroff_count -= 5;
- X continue;
- X }
- X else
- X {
- X continue;
- X }
- X }
- X
- X else if (c == '\b')
- X n--;
- X else if (c == '\n')
- X { if (count_lines)
- X { /* remove 3 blank lines between pages
- X 1 from beginning of page,
- X 2 from end of page.
- X */
- X nroff_count = (nroff_count + 10) % (nroff_lines * 10);
- X if (nroff_count < 20 || nroff_count > (nroff_lines - (remove-1)) * 10)
- X continue;
- X }
- X how[n] = 0;
- X line[n] = 0;
- X for (i = 0; i <= n; i++)
- X {
- X if (how[i])
- X { /* either bold or underlined see if previous char
- X is not escaped - indicates the beginning of
- X an escape sequence. may need to terminate
- X previous sequence first (e.g. bold followed
- X by underlined).
- X */
- X if (i > 0 && how[i-1] && (how[i] != how[i-1]))
- X { if (how[i-1] == 1)
- X send (END_BOLD);
- X else
- X send (underline_off);
- X }
- X if (how[i] == 1 && (i == 0 || how[i-1] != 1))
- X send (BEGIN_BOLD);
- X else if (how[i] == 2 && (i == 0 || how[i-1] != 2))
- X send (underline_on);
- X }
- X else /* zero means just a character, unmodified */
- X { /* are we at the end of an escape sequence? */
- X if (i > 0)
- X { if (how[i-1] == 1)
- X send (END_BOLD);
- X else if (how[i-1] == 2)
- X send (underline_off);
- X }
- X }
- X if (line[i])
- X putchar (line[i]);
- X }
- X putchar ('\n');
- X clear (line, how, n);
- X n = 0;
- X }
- X else
- X { if (line[n])
- X { if (line[n] == c) /* same character? */
- X how[n] = 1; /* yes: bold */
- X else
- X how[n] = 2; /* no: underline */
- X }
- X line[n++] = c;
- X }
- X }
- X}
- X
- Xclear (line, how, n)
- Xchar *line;
- Xint *how;
- Xint n;
- X{
- X int i;
- X
- X for (i = 0; i <= n; i++)
- X { line[i] = '\0';
- X how[i] = 0;
- X }
- X}
- X
- Xsend (s)
- Xchar *s;
- X{
- X while (*s)
- X putchar (*s++);
- X}
- X
- Xusage ()
- X{
- X fprintf (stderr, "Usage: pnf [-i] [ -f ] [ -l n ] [ -r n ] file ... >out.file\n");
- X fprintf (stderr, " where -i = use italics in lieu of underline\n");
- X fprintf (stderr, " -f = document has form feeds, ignore line count\n");
- X fprintf (stderr, " -l n = make n line nroff'ed documents fit\n");
- X fprintf (stderr, " -r n = number of blank lines to remove\n");
- X fprintf (stderr, " file = input files (or stdin)\n");
- X exit (0);
- X}
- END_OF_FILE
- if test 6253 -ne `wc -c <'pnf.c'`; then
- echo shar: \"'pnf.c'\" unpacked with wrong size!
- fi
- # end of 'pnf.c'
- fi
- if test -f 'selectdef.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'selectdef.c'\"
- else
- echo shar: Extracting \"'selectdef.c'\" \(5950 characters\)
- sed "s/^X//" >'selectdef.c' <<'END_OF_FILE'
- X/* ta=4 */
- X/* allow user to select printer from various *.def files
- X and also select defaule page size (letter, a4 etc)
- X
- X selected printer is in file Ppsfprint.cfg
- X seleted page size is in file Ppagesize.cfg
- X
- X This also generates a postscript programme (psizes.ps) that should be
- X sent to the printer to print out the actual imageable area.
- X*/
- X
- X#include <stdio.h>
- X
- X#define printerdef "Ppsfprint.cfg"
- X
- Xtypedef struct /* measurement in point */
- X{ char paper_name[60]; /* name of paper size (for command line) */
- X char paper_tray[200]; /* postscript operator to select this tray */
- X int width; /* portrait point width of paper */
- X int height; /* portrait point height of paper */
- X} measure;
- X
- Xchar *psheader = "%!\n\
- X/getsize {\n\
- X clippath\n\
- X pathbbox\n\
- X} def\n\
- X/sendsize {\n\
- X /ury exch def\n\
- X /urx exch def\n\
- X /lly exch def\n\
- X /llx exch def\n\
- X /str 64 string def\n\
- X show\n\
- X ( ) show\n\
- X llx ceiling cvi str cvs show\n\
- X ( ) show\n\
- X lly ceiling cvi str cvs show\n\
- X ( ) show\n\
- X urx floor cvi str cvs show\n\
- X ( ) show\n\
- X ury floor cvi str cvs show\n\
- X} def\n\
- X/pg save def\n\
- Xnewpath\n";
- X
- Xchar *psfont = "/Courier findfont 12 scalefont setfont\n";
- X
- Xchar *pstail = "showpage \n\
- Xpg restore\n\004";
- X
- Xchar printername[100];
- Xint defaultsize;
- X
- Xmain (argc, argv)
- Xint argc;
- Xchar *argv[];
- X{ int i,j;
- X int many, n, pnumber;
- X char printers[100];
- X FILE *fp, *fpdef;
- X
- X if (argc < 2)
- X { fprintf (stderr, "Cannot find printer definition files (*.def)...\n");
- X exit (1);
- X }
- X
- Xrefresh:
- X puts ("\n\n SELECT PRINTER TYPE\n");
- X many = 0;
- X for (i = 1; i < argc; i++)
- X { if ((fp = fopen (argv[i], "r")) == NULL)
- X exit (1);
- X fgets (printers, 99, fp);
- X trim (printers);
- X n = strlen (printers);
- X if (n < 35)
- X n = 35;
- X many += n;
- X if (many > 70)
- X { many = n;
- X printf ("\n");
- X }
- X printf ("%2d: %-35s", i, printers);
- X fclose (fp);
- X }
- X printf ("\n");
- X do
- X { printf ("==> Select printer by number (q = quit, r = refresh display): ");
- X gets (printers);
- X if (toupper (*printers) == 'Q')
- X exit (44);
- X if (toupper (*printers) == 'R')
- X goto refresh;
- X pnumber = atoi (printers);
- X if (pnumber < 1 || pnumber > argc)
- X puts ("... Invalid printer number");
- X else
- X break;
- X } while (1);
- X if (access (argv[pnumber], 4) == 0)
- X {
- X if ((fpdef = fopen (printerdef, "w")) != NULL)
- X { fprintf (fpdef, "%s", argv[pnumber]);
- X fclose (fpdef);
- X getsize (argv[pnumber]);
- X genpost (argv[pnumber]);
- X }
- X else
- X { fprintf (stderr, "Cannot create printer definition file: %s\n", printerdef);
- X exit (1);
- X }
- X fclose (fp);
- X }
- X else
- X { fprintf (stderr, "Cannot find printer definition file: %s\n", argv[pnumber]);
- X exit (1);
- X }
- X exit (0);
- X}
- Xgetsize (fn)
- Xchar *fn;
- X{ char ptypes[40][100];
- X char line[100];
- X int ntypes, i, ncol, pnumber;
- X FILE *fpdef;
- X
- X if ((fpdef = fopen (fn, "r")) != NULL)
- X { fgets (printername, 99, fpdef);
- X trim (printername);
- X ntypes = 1;
- X for ( ; ; )
- X { fgets (line, 99, fpdef);
- X if (*line == '*')
- X break;
- X trim (line);
- X strcpy (ptypes[ntypes], line);
- X fgets (line, 99, fpdef);
- X fgets (line, 99, fpdef);
- X ntypes++;
- X }
- X fclose (fpdef);
- X
- Xref:
- X printf ("\nPrinter is: %s\n\nSelect default page size:\n", printername);
- X for (i = 1; i < ntypes; i++)
- X { printf ("%2d: %s\n", i, ptypes[i]);
- X }
- X do
- X { printf ("==> Select page size by number (q = quit, r = refresh display): ");
- X gets (line);
- X if (toupper (*line) == 'Q')
- X exit (44);
- X if (toupper (*line) == 'R')
- X goto ref;
- X pnumber = atoi (line);
- X if (pnumber < 1 || pnumber > ntypes)
- X puts ("... Invalid page size number");
- X else
- X break;
- X } while (1);
- X fclose (fpdef);
- X ptypes[ntypes][0] = '\0';
- X if ((pnumber > 0 && pnumber < ntypes)
- X && (fopen ("Ppagesize.cfg", "w")) != NULL)
- X {
- X fprintf (fpdef, "%s", ptypes[pnumber]);
- X fclose (fpdef);
- X defaultsize = pnumber - 1;
- X }
- X }
- X else
- X { fprintf (stderr, "Cannot find printer definition file: %s\n", printerdef);
- X exit (1);
- X }
- X exit (0);
- X}
- X
- Xgenpost (f)
- Xchar *f;
- X{
- X FILE *pdef, *psfile;
- X char line[500];
- X measure page_types[40];
- X int i, j;
- X int x, y;
- X
- X if ((pdef = fopen (f, "r")) != NULL)
- X {
- X fgets (line, 100, pdef);
- X for (i = 0; i < 28; i++)
- X { if (fgets (page_types[i].paper_name, 59, pdef) == NULL)
- X break;
- X trim (page_types[i].paper_name);
- X if (page_types[i].paper_name[0] == '*')
- X break;
- X if (fgets (page_types[i].paper_tray, 199, pdef) == NULL)
- X bad_file();
- X trim (page_types[i].paper_tray);
- X if (fgets (line, 100, pdef) == NULL)
- X bad_file();
- X trim (line);
- X sscanf (line, "%d%d",
- X &page_types[i].width,
- X &page_types[i].height);
- X
- X }
- X page_types[i].paper_name[0] = '\0';
- X fclose (pdef);
- X if ((psfile = fopen ("psizes.ps", "w")) != NULL)
- X { fprintf (psfile, "%s", psheader);
- X for (j = i-1; j >= 0; j--)
- X { lcase (line, page_types[j].paper_name);
- X fprintf (psfile, "%s\n(%s: %d %d) getsize\n",
- X line,
- X page_types[j].paper_name,
- X page_types[j].width,
- X page_types[j].height);
- X }
- X fprintf (psfile, "%s\n", page_types[defaultsize].paper_tray);
- X fprintf (psfile, "%s", psfont);
- X x = 50;
- X y = 600;
- X fprintf (psfile, "%d %d moveto\n", x, y);
- X fprintf (psfile, "(Imageable area) show\n");
- X y -= 15;
- X fprintf (psfile, "%d %d moveto\n", x, y);
- X fprintf (psfile, "(");
- X send (printername, psfile);
- X fprintf (psfile, ") show\n");
- X y -= 20;
- X for (j = i-1; j >= 0; j--)
- X {
- X fprintf (psfile, "%d %d moveto\nsendsize\n", x, y);
- X y -= 15;
- X }
- X fprintf (psfile, "%s", pstail);
- X }
- X }
- X}
- X
- Xtrim (s)
- Xchar *s;
- X{
- X while (*s)
- X { if (*s < ' ')
- X { *s = 0;
- X break;
- X }
- X s++;
- X }
- X}
- X
- Xbad_file()
- X{
- X fprintf (stderr, "Bad %s file\n", PDEF);
- X exit (1);
- X}
- X
- Xlcase (a, b)
- Xchar *a, *b;
- X{
- X while (*b)
- X { *a++ = tolower (*b);
- X b++;
- X }
- X *a = '\0';
- X}
- X
- Xsend (s, fp)
- Xchar *s;
- XFILE *fp;
- X{
- X char *strchr();
- X
- X while (*s)
- X {
- X if (strchr ("\r\b\\()", *s) != NULL)
- X fputc ('\\', fp);
- X fputc (*s, fp);
- X s++;
- X }
- X}
- END_OF_FILE
- if test 5950 -ne `wc -c <'selectdef.c'`; then
- echo shar: \"'selectdef.c'\" unpacked with wrong size!
- fi
- # end of 'selectdef.c'
- fi
- echo shar: End of archive 3 \(of 6\).
- cp /dev/null ark3isdone
- MISSING=""
- for I in 1 2 3 4 5 6 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 6 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
-